import request from '@/utils/request'
import apis from './'

export function getInvoiceList (parameter) {
  return request({
    url: apis.InvoiceList,
    method: 'get',
    params: parameter
  })
}

export function getMyInvoiceList (parameter) {
  return request({
    url: apis.MyInvoice,
    method: 'get',
    params: parameter
  })
}

export function getInvoiceNum (parameter) {
  return request({
    url: apis.InvoiceNum,
    method: 'get',
    params: parameter
  })
}

export function getMyInvoiceDetail (id) {
  return request({
    url: `${apis.InvoiceDetail}?invoice_id=${id}`,
    method: 'get'
  })
}

export function getAddInvoice (id) {
  return request({
    url: `${apis.GetInvoice}?cp_id=${id}`,
    method: 'get'
  })
}

export function postAddInvoice (data) {
  return request({
    url: `${apis.GetInvoice}?cp_id=${data.contract_id}`,
    method: 'post',
    data: data
  })
}
export function SetInvoiceRead (id) {
  return request({
    url: `${apis.InvoiceRead}?invoice_id=${id}`,
    method: 'get'
  })
}

export function getEditInvoice (id) {
  return request({
    url: `${apis.EditInvoice}`,
    method: 'get'
  })
}

export function postEditInvoice (data) {
  return request({
    url: `${apis.EditInvoice}`,
    method: 'post',
    data: data
  })
}
